<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script>
			var week=["星期天","星期一"];
			var timer;
			var $d=document;
			function showTime()
			{
				var d=$d.getElementById("time");
				//week[date.getDay()]
				
				d.innerHTML=new Date().toLocaleString();
			}
			function init()
			{
				showTime();
				//window.setInterval("showTime()",1000);
				timer=window.setInterval(function(){
					var d=document.getElementById("time");
					d.innerHTML=new Date().toLocaleString();
				},1000);
			}
			function stopTime()
			{
				window.clearInterval(timer);
			}
		</script>
	</head>
	<body onload="init()">
		<div id="time"></div>
		<input type="button" value="时间停止" onclick="stopTime()"/>
	</body>
</html>
